<template>
  <div id="examine">
    <el-tabs v-model="activeName" class="tabPlane">
      <el-tab-pane label="信息审核" name='1'>
        <div class="goback" @click="routerGoBack">
          <i class="el-icon-arrow-left" style="font-size:14px;vertical-align: middle;"></i>返回
        </div>
        <div class="contentClass onlyShowContent">
          <h2 style="font-weight:600;font-size:16px;">审核状态：{{auditStatus | examineFilter}}</h2>
          <el-row type="flex" justify="start">
            <el-col :span="4" style="min-width: 300px">
              <div class="clearFix p10">
                <div style="width: 130px;display: inline-block;">
                  <img :src="studentHeader" style="width: 130px;height: 167px;">
                  <p style="text-align: center">入学照片</p>
                </div>
                <div style="width: 130px;display: inline-block;">
                  <img :src="lifeHeadUrl" style="width: 130px;height: 167px;">
                  <p style="text-align: center">生活照片</p>
                </div>
              </div>
            </el-col>
            <el-col :span="20" v-if="auditStatus=== -1" flex="1" class="p10">
              <h2 style="font-weight:600;font-size:16px;">驳回原因</h2>
              <p style="border:1px solid #e4e7ed;min-height:123px;margin-top:13px;border-radius:4px;">
                {{auditComment}}</p>
            </el-col>
          </el-row>
          <el-form :model="basicInfoForm" status-icon ref="basicInfoForm" label-position="top">
            <el-row :gutter="100">
              <el-col :span="24">
                <h2 class="titleH">基本信息</h2>
              </el-col>
              <el-col :span="8">
                <el-form-item label="学号" prop="sn">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.sn" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="姓名" prop="name">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.name" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('name')" class="beforeUpdateShow">修改前：{{beforeBasicInfoForm.name |
                    nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="曾用名" prop="formerName">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.formerName" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('formerName')" class="beforeUpdateShow">
                    修改前：{{beforeBasicInfoForm.formerName | nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="性别" prop="gender">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.gender" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('gender')" class="beforeUpdateShow">修改前：{{beforeBasicInfoForm.gender |
                    nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="民族" prop="nation">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.nation" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('nation')" class="beforeUpdateShow">修改前：{{beforeBasicInfoForm.nation |
                    nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="国籍" prop="nationality">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.nationality" autocomplete="off"></el-input>
                  <!-- <p v-if="isShowOrHidddeUpdate('nationality')" class="beforeUpdateShow">修改前：{{beforeBasicInfoForm.nationality |
                    nullFilter}}</p> -->
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="政治面貌" prop="politicsStatus">
                  <el-input disabled size='small' v-model="basicInfoForm.politicsStatus" value-key='id'></el-input>
                  <p v-if="isShowOrHidddeUpdate('politicsStatus')" class="beforeUpdateShow">
                    修改前：{{beforeBasicInfoForm.politicsStatus | nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="籍贯" prop="nativePlace">
                  <el-input disabled size='small' v-model="basicInfoForm.nativePlace" value-key='id'></el-input>
                  <p v-if="isShowOrHidddeUpdate('nativePlace')" class="beforeUpdateShow">
                    修改前：{{beforeBasicInfoForm.nativePlace | nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="身份证号" prop="idNumber">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.idNumber" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('idNumber')" class="beforeUpdateShow">修改前：{{beforeBasicInfoForm.idNumber
                    | nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="出生日期" prop="birthDate">
                  <el-input disabled size="small" type="text" :value="basicInfoForm.birthDate | moment('YYYY-MM-DD')" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('birthDate')" class="beforeUpdateShow">
                    修改前：{{beforeBasicInfoForm.birthDate | nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="健康状况" prop="healthState">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.healthState" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('healthState')" class="beforeUpdateShow">
                    修改前：{{beforeBasicInfoForm.healthState | nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="血型" prop="bloodType">
                  <el-input disabled size='small' v-model="basicInfoForm.bloodType" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('bloodType')" class="beforeUpdateShow">
                    修改前：{{beforeBasicInfoForm.bloodType | nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="宗教信仰" prop="religion">
                  <el-input disabled size='small' v-model="basicInfoForm.religion" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('religion')" class="beforeUpdateShow">修改前：{{beforeBasicInfoForm.religion
                    | nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="现在户口所在地" prop="currentDomicilePlace">
                  <el-input disabled size='small' v-model="basicInfoForm.currentDomicilePlace" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('currentDomicilePlace')" class="beforeUpdateShow">
                    修改前：{{beforeBasicInfoForm.currentDomicilePlace | nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="火车乘车区间" prop="trainSection">
                  <el-input disabled size='small' v-model="basicInfoForm.trainSection" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('trainSection')" class="beforeUpdateShow">修改前：{{beforeBasicInfoForm.trainSection | nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="婚姻状况" prop="maritalStatus">
                  <el-input disabled size='small' v-model="basicInfoForm.maritalStatus" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('maritalStatus')" class="beforeUpdateShow">
                    修改前：{{beforeBasicInfoForm.maritalStatus | nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="与学校联名银行卡账户" prop="openingBank">
                  <el-input disabled size='small' v-model="basicInfoForm.openingBank" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('openingBank')" class="beforeUpdateShow">
                    修改前：{{beforeBasicInfoForm.openingBank | nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="银行卡号" prop="bankCard">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.bankCard" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('bankCard')" class="beforeUpdateShow">修改前：{{beforeBasicInfoForm.bankCard
                    | nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="特长爱好" prop="hobby">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.hobby" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('hobby')" class="beforeUpdateShow">修改前：{{beforeBasicInfoForm.hobby |
                    nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="校园一卡通卡号" prop="metroCard">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.metroCard" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('metroCard')" class="beforeUpdateShow">
                    修改前：{{beforeBasicInfoForm.metroCard | nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="辅导员姓名" prop="instructorName">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.instructorName" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="班主任姓名" prop="classTeacher">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.classTeacher" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="身高(cm)" prop="stature">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.stature" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('stature')" class="beforeUpdateShow">修改前：{{beforeBasicInfoForm.stature |
                    nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="体重(kg)" prop="weight">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.weight" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('weight')" class="beforeUpdateShow">修改前：{{beforeBasicInfoForm.weight |
                    nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <h2 class="titleH">学籍信息</h2>
              </el-col>
              <el-col :span="8">
                <el-form-item label="所属学院" prop="collegeName">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.collegeName" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="所属专业" prop="majorName">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.majorName" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="所属年级" prop="grade">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.grade" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="所属班级" prop="className">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.className" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="生源类型" prop="sourceType">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.sourceType" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="学籍状态" prop="educationStatus">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.educationStatus" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="学生类型" prop="education">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.education" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('education')" class="beforeUpdateShow">
                    修改前：{{beforeBasicInfoForm.education | nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="是否在籍" prop="absentee">
                  <el-input disabled size="small" type="text" :value="basicInfoForm.absentee | isTransform" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="是否在校" prop="atSchool">
                  <el-input disabled size="small" type="text" :value="basicInfoForm.atSchool | isTransform" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="毕业时间（预计）" prop="graduateDate">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.graduateDate" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('graduateDate')" class="beforeUpdateShow">
                    修改前：{{beforeBasicInfoForm.graduateDate | nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <h2 class="titleH">入学信息</h2>
              </el-col>
              <el-col :span="8">
                <el-form-item label="入学年月" prop="enterDate">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.enterDate" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('enterDate')" class="beforeUpdateShow">
                    修改前：{{beforeBasicInfoForm.enterDate | nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="入学前户口所在地" prop="domicilePlace">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.domicilePlace" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('domicilePlace')" class="beforeUpdateShow">
                    修改前：{{beforeBasicInfoForm.domicilePlace | nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="生源地" prop="sourcePlace">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.sourcePlace" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('sourcePlace')" class="beforeUpdateShow">
                    修改前：{{beforeBasicInfoForm.sourcePlace | nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="入学前就读中学" prop="highSchool">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.highSchool" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('highSchool')" class="beforeUpdateShow">
                    修改前：{{beforeBasicInfoForm.highSchool | nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="高考分数" prop="satScores">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.satScores" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="邮寄录取通知书家庭地址" prop="mailHomeAddress">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.mailHomeAddress" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="邮寄录取通知书收件人姓名" prop="addresseeName">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.addresseeName" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="邮寄录取通知书收件人电话" prop="addresseePhone">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.addresseePhone" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <h2 class="titleH">通讯信息</h2>
              </el-col>
              <el-col :span="8">
                <el-form-item label="宿舍分布区" prop="dormitoryArea">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.dormitoryArea" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="寝室号" prop="dorm">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.dorm" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="联系电话" prop="phone">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.phone" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('phone')" class="beforeUpdateShow">修改前：{{beforeBasicInfoForm.phone |
                    nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="备用电话" prop="standbyPhone">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.standbyPhone" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('standbyPhone')" class="beforeUpdateShow">
                    修改前：{{beforeBasicInfoForm.standbyPhone | nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="微信号" prop="wechat">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.wechat" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('wechat')" class="beforeUpdateShow">修改前：{{beforeBasicInfoForm.wechat |
                    nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="QQ号码" prop="qq">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.qq" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('qq')" class="beforeUpdateShow">修改前：{{beforeBasicInfoForm.qq |
                    nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="邮箱" prop="email">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.email" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('email')" class="beforeUpdateShow">修改前：{{beforeBasicInfoForm.email |
                    nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="家庭电话" prop="familyPhone">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.familyPhone" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('familyPhone')" class="beforeUpdateShow">
                    修改前：{{beforeBasicInfoForm.familyPhone | nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="家庭电子邮箱" prop="familyEmail">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.familyEmail" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('familyEmail')" class="beforeUpdateShow">
                    修改前：{{beforeBasicInfoForm.familyEmail | nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="家庭所在地区" prop="familyPlace">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.familyPlace" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('familyPlace')" class="beforeUpdateShow">
                    修改前：{{beforeBasicInfoForm.familyPlace | nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="家庭详细地址" prop="familyDetailAddress">
                  <el-input disabled size="small" type="text" v-model="basicInfoForm.familyDetailAddress" autocomplete="off"></el-input>
                  <p v-if="isShowOrHidddeUpdate('familyDetailAddress')" class="beforeUpdateShow">
                    修改前：{{beforeBasicInfoForm.familyDetailAddress | nullFilter}}</p>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <h2 class="titleH">家庭信息</h2>
              </el-col>
              <el-col :span="24">
                <p>父母类</p>
                <relational-table :datas="studentParents" />
              </el-col>
              <el-col :span="24">
                <p>直系亲属类</p>
                <relational-table :datas="studentrelatives" />
              </el-col>
              <el-col :span="24">
                <p>其他社会重要联系人类</p>
                <relational-table :datas="studentFriends" />
              </el-col>
              <el-col :span="24" v-if="auditStatus==0">
                <el-form-item style="text-align:center;margin-top:30px;">
                  <el-button @click="dialogVisible= true" style="width:100px;">驳回</el-button>
                  <el-button type="primary" @click="resolveExamine" style="width:100px;">通过</el-button>
                </el-form-item>
              </el-col>

              <!--驳回弹窗-->
              <el-dialog title="信息审核" :visible.sync="dialogVisible" width="30%">
                <el-form :model="ruleForm" ref="ruleForm" label-width="100px" :label-position="'top'" class="demo-ruleForm" :hide-required-asterisk="true">
                  <el-form-item label="请输入驳回理由：" prop="reason" :rules="rules">
                    <el-input type="textarea" autosize v-model.number="ruleForm.reason" maxlength="100" autocomplete="off"></el-input>
                  </el-form-item>
                </el-form>
                <span slot="footer" class="dialog-footer">
                  <el-button @click="dialogVisible = false">取 消</el-button>
                  <el-button type="primary" @click="rejectExamine">确 定</el-button>
                </span>
              </el-dialog>
            </el-row>
          </el-form>
        </div>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script>
import defaultPic from '@/assets/images/defaultPic.png'
import {counsellor} from '@api/index'
import RelationalTable from '../../components/relationalTable'
// import {studentStatus} from '@/tools/utils'
export default {
  name: 'examine',
  components: {RelationalTable},
  data () {
    let validatePass = (rule, value, callback) => {
      // let reg = /^\s{0,100}$/
      console.log(value)
      if (!value) {
        callback(new Error('请输入驳回理由'))
      } else {
        callback()
      }
    }
    return {
      activeName: '1',
      auditComment: null, // 驳回理由
      auditStatus: null, // 审批状态
      basicInfoForm: {
        sn: null,
        name: null,
        gender: null,
        picUrl: null,
        lifeHeadUrl: null
      },
      beforeBasicInfoForm: {},
      studentParents: [],
      studentrelatives: [],
      studentFriends: [],
      dialogVisible: false,
      ruleForm: {
        reason: ''
      },
      rules: [
        { validator: validatePass }
      ]
    }
  },
  computed: {
    studentHeader () {
      return this.basicInfoForm.picUrl ? `./api/common/getHeadPic?picUrl=${this.basicInfoForm.picUrl}` : defaultPic
    },
    lifeHeadUrl () {
      return this.basicInfoForm.lifeHeadUrl ? `./api/common/getHeadPic?picUrl=${this.basicInfoForm.lifeHeadUrl}` : defaultPic
    }
  },
  created () {
    this.initPage()
  },
  methods: {
    initPage () {
      this.getExamineInfoById()
    },
    routerGoBack () {
      this.$router.push({
        name: 'counsellor_examineStudentList'
      })
    },
    // 根据id获取详细审批数据
    getExamineInfoById () {
      counsellor()._findCommitHistoryInfoById(this.$route.query.id).then(res => {
        if (res.status) {
          if (res.data.studentModifyAudit.auditComment) {
            this.auditComment = res.data.studentModifyAudit.auditComment
          }
          this.auditStatus = res.data.studentModifyAudit.auditStatus
          const data = res.data.studentModifyAudit
          Object.assign(this.basicInfoForm,
            res.data,
            data,
            data.studentBasicModify,
            data.studentContactModify,
            data.studentEducationModify,
            {
              trainSection: (data.studentBasicModify.departurePlace || data.studentBasicModify.destinationPlace) ? `${data.studentBasicModify.departurePlace}-${data.studentBasicModify.destinationPlace}` : ''
            }
          )
          Object.assign(this.beforeBasicInfoForm,
            res.data,
            data,
            data.studentBasicHistory,
            data.studentContactHistory,
            data.studentEducationHistory,
            {
              trainSection: (data.studentBasicHistory.departurePlace || data.studentBasicHistory.destinationPlace) ? `${data.studentBasicHistory.departurePlace}-${data.studentBasicHistory.destinationPlace}` : ''
            }
          )

          if (this.beforeBasicInfoForm.birthDate) {
            this.beforeBasicInfoForm.birthDate = this.$moment(this.beforeBasicInfoForm.birthDate).format('YYYY-MM-DD')
          }
          if (this.beforeBasicInfoForm.enterDate) {
            this.beforeBasicInfoForm.enterDate = this.$moment(this.beforeBasicInfoForm.enterDate).format('YYYY-MM-DD')
          }
          if (this.beforeBasicInfoForm.graduateDate) {
            this.beforeBasicInfoForm.graduateDate = this.$moment(this.beforeBasicInfoForm.graduateDate).format('YYYY-MM')
          }
          if (this.basicInfoForm.birthDate) {
            this.basicInfoForm.birthDate = this.$moment(this.basicInfoForm.birthDate).format('YYYY-MM-DD')
          }
          if (this.basicInfoForm.enterDate) {
            this.basicInfoForm.enterDate = this.$moment(this.basicInfoForm.enterDate).format('YYYY-MM-DD')
          }
          if (this.basicInfoForm.graduateDate) {
            this.basicInfoForm.graduateDate = this.$moment(this.basicInfoForm.graduateDate).format('YYYY-MM')
          }

          this.studentParents = data.studentFamilies.filter((item) => {
            return item.type === 0
          })
          this.studentrelatives = data.studentFamilies.filter((item) => {
            return item.type === 1
          })
          this.studentFriends = data.studentFamilies.filter((item) => {
            return item.type === 2
          })
        }
      })
    },
    // 驳回
    rejectExamine () {
      let id = this.$route.query.id
      this.$refs['ruleForm'].validate((valid) => {
        console.log(valid)
        if (valid) {
          counsellor()._rejectById({
            'id': id,
            'reason': this.ruleForm.reason
          }).then(res => {
            if (res.status) {
              this.$message(res.message)
              this.dialogVisible = false
              this.getExamineInfoById()
            }
          })
        } else {
          console.log('error submit!!')
          return false
        }
      })
    },
    isShowOrHidddeUpdate (key) {
      if (this.basicInfoForm[key] !== this.beforeBasicInfoForm[key]) {
        return true
      } else {
        return false
      }
    },
    // 通过
    resolveExamine () {
      this.$confirm('是否确认通过审核？', '信息审核', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        closeOnClickModal: false,
        type: 'warning'
      }).then(() => {
        counsellor()._passById(this.$route.query.id).then(res => {
          if (res.status) {
            this.$message(res.message)
            this.getExamineInfoById()
          }
        })
      }).catch(() => {

      })
    }
  }
}
</script>
